package com.java1902.grademanager;

import java.util.ArrayList;
import java.util.List;

public class Test {

	public static void main(String[] args) {
		Grade javaGrade = new Grade("java1901","g001");  
		Grade iosGrade = new Grade("IOS1903","g002");  

		Student zhangs = new Student(1001,"张三",20,"男");
		Student xiaoli = new Student(1002,"小丽",22,"女");
		Student xiaomin = new Student(1003,"小明",21,"男");
 	
		//建立关系，学生选班
	    //张三，小丽选择java1901班: 本质就是，将张三，小丽添加到java1901班存储学生的容器属性中
		//建立 班级->学生的关联
		List<Student> studentLists = javaGrade.getStudentLists();
		studentLists.add(zhangs);
		studentLists.add(xiaoli);

		//学生->班级关联
		zhangs.setGrade(javaGrade); //张三所在班级是java班
		xiaoli.setGrade(javaGrade); //小丽所在班级是java班
		
		
 		
 		//查找java班下的所有学生
// 		for (Student student : javaGrade.getStudentLists()) {
//			System.out.println(student);
//		}
		
		//学生小丽所在班级
		Grade g1 = xiaoli.getGrade();
		System.out.println(g1);
		
	}

}
